/// @tags:
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

using ll = long long;

constexpr int maxn = 1e6 + 2, base = 29, mod = 1e9 + 9;

ll pre[maxn * 2], suf[maxn * 2], inv[maxn * 2];
char t[maxn * 2];

ll prehash(int l, int r) {
  ll res = 0;
  res = pre[r] - pre[l - 1] * inv[r - l + 1] % mod;
  if (res < 0) res += mod;
  return res;
}

int n;

ll sufhash(int l, int r) {
  ll res = 0;
  res = suf[l] - suf[r + 1] * inv[r - l + 1] % mod;
  if (res < 0) res += mod;
  return res;
}

bool check() {
  for (int i = 1; i <= n; ++i) {
    if (t[i] != t[n * 2 - i + 1]) return false;
  }
  return true;
}

int main() {
  cin >> n;
  cin >> (t + 1);
  inv[0] = 1;
  for (int i = 1; i <= n * 2; ++i) {
    inv[i] = inv[i - 1] * 29 % mod;
    pre[i] = pre[i - 1] * base % mod + t[i] - 'a' + 1;
    if (pre[i] >= mod) pre[i] -= mod;
  }
  for (int i = n * 2; i >= 1; --i) {
    suf[i] = suf[i + 1] * base % mod + t[i] - 'a' + 1;
    if (suf[i] >= mod) suf[i] -= mod;
  }
  bool flag = false;
  for (int i = 1; i < n; ++i) {
    if (prehash(1, i) == sufhash(n + 1, n + i) &&
        prehash(n + i + 1, 2 * n) == sufhash(i + 1, n)) {
      for (int j = i + n; j >= i + 1; j--) cout << t[j];
      cout << '\n';
      cout << i << endl;
      flag = true;
      break;
    }
  }
  if (!flag && check()) {
    for (int i = 1; i <= n; ++i) {
      cout << t[i];
    }
    cout << '\n';
    cout << n << endl;
    flag = true;
  }
  if (!flag) {
    cout << -1 << endl;
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("F - ABCBAC.in", "r", stdin);
  freopen("F - ABCBAC.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
